<!doctype html>
<html>
<head>
	<meta charset="utf-8">
	<title></title>
	<link rel="stylesheet" href="${staticServer}/inc/style/main.css"/>
	<link rel="stylesheet" href="${staticServer}/inc/style/page.css"/>
	<link rel="stylesheet" href="${staticServer}/css/consultant_client.css"/>
	<link rel="stylesheet" href="${staticServer}/css/consultant_personal_stat.css"/>
	<script src="${staticServer}/inc/js/jquery.js"></script>
	<script src="${staticServer}/inc/js/pageset.js"></script>
	<script src="${staticServer}/inc/js/infopad.js?2.2"></script>
	<script src="${staticServer}/inc/js/htmlfilter.js"></script>
	<script src="${staticServer}/inc/js/model_resp.js"></script>
	
	<link rel="stylesheet" href="${staticServer}/inc/style/date/datepicker.css"/>
    <script src="${staticServer}/inc/js/datepicker.js"></script>
	
	<script>
	//var infopad = parent.infopad;

	function init()
	{
	
	}
	function starquery( types )
	{
		var url = "";

		if( types == 0 )
		{
			var sdate = $( "#start_date" ).val();
			var keuser = $("#keuser").val();
			var type = $("#type").val();
			var param_str = "";

			if( !empty( sdate ) ) param_str += "&sdate=" + sdate;
			if( !empty( keuser ) ) param_str += "&keuser=" + keuser;
			if( !empty( type ) ) param_str += "&type=" + type;
			
			url = "?" + param_str;
		}
		else
		{
			url = "?";
		}

		location.href = url;
	}

$(function(){
	$("#keuser").val('${keuser}');
	
	$("#sp_user_ipt").change(function(){
		var nickname = $("#sp_user_ipt").val();
		$.post("${contextPath}/admin/getUserBynickname.json", {
			"nickname" : nickname
		}, function(ms) {
			 if(ms.user!=null){
			 	var username = ms.user.username;
			 	$("#keuser").val(username);
			 }
			
		});
	});
});

		function getXiaZai() {
            var sdate = $("#start_date").val();
            if (start_date == "") {
                alert("时间不能为空");
                return;
            }else{
            	infopad.msg("正在下载，请稍等!");
            }
            $.post('${contextPath}/index/consultant_performance_stat_xzgz.json', {
                sdate: sdate
            }, function (data) {
                if (data) {
                    if (data.name != null) {
                        window.location.href = "http://120.55.241.58/mydata/uploadtea/xls/" + data.name;
                    }
                }
            });
        }
        
        function getXiaZai2() {
            var sdate = $("#start_date").val();
            if (start_date == "") {
                alert("时间不能为空");
                return;
            }else{
            	infopad.msg("正在下载，请稍等!");
            }
            $.post('${contextPath}/index/consultant_performance_stat_xz.json', {
                sdate: sdate
            }, function (data) {
                if (data) {
                    if (data.name != null) {
                        window.location.href = "http://120.55.241.58/mydata/uploadtea/xls/" + data.name;
                    }
                }
            });
        }
	</script>
</head>

<body>
	<div id="home_link">
		<ul>
			<li></li>
			<li>&gt;</li>
			<li>资源统计管理</li>
			<li>&gt;</li>
			<li class="current">绩效统计</li>
		</ul>
	</div>
	<input type="hidden" id="type" value="${type}">
	<div id="container">
		<div id="title"></div>

		<div class="fieldset_container">
			<fieldset>
				<legend>查询条件</legend>
				<ul>
					<li><label>查询月份：</label><input type="text" id="start_date" size="15" value="${sdate}" rel="DATE::Y-m"/></li>
					
					<#if webutil.getCookieUser().username ="yuanjing" || webutil.getCookieUser().username ="wangjiawei"  ||  webutil.getCookieUser().usergroup=="8" || (webutil.getCookieUser().menu!="" && webutil.getCookieUser().menu?contains("d") && type=="1")>
						<li><label>课程老师：</label>
						<select name="keuser" id="keuser">
		                	<option value="">-- 请选择目标 --</option>
		                	<#if uList??>
								<#list uList as list>
		                			<option value="${list.username}">${list.nickname}（${list.regions}-${list.departments}-${list.job}）</option>
		                		</#list>
		                	</#if>
		                </select>
		                <input type="text" id="sp_user_ipt" size="10" value="">
						</li>
						<input type="button" value=" 主管绩效下载 " onclick="getXiaZai()"/>
						<input type="button" value=" 普通职员绩效下载 " onclick="getXiaZai2()"/>
					</#if>
					<li class="controlbar">
						<input type="button" value=" 统 计 " onclick="starquery(0)"/>
						<input type="button" value=" 重 置 " onclick="starquery(1)"/>
					</li>
				</ul>
			</fieldset>
		</div>


		<table>
			<tr class="fields">
				<th>个人绩效统计</th>
			</tr>
				<tr>
					<td>
						<table id="tbl_reception_<?php echo $i ?>" style="min-width: 100px; width: 80%; float: left; margin: 2px;">
							<tr class="fields">
								<th colspan="2" style="">
									<span class="unit size14 stress"><#if start??>${start?date}</#if>到<#if end??>${end?date}</#if></span></th>
								<td style="text-align: center;">
									<span class="size14 stress">权  重</span>
								</td>
								<td style="text-align: center;">
									<span class="size14 stress">核算方法</span>
								</td>
							</tr>
						<#if users?? && users.qq_group==8>
						
						<#else>
							<tr>
								<th  width="30%">当月接待成交率</th>
								<td width="30%"><span class="statbar" rel="<#if sum_rece=='0'>0<#else>root</#if>">${sum_rece}</span></td>
								<td  width="10%" style="text-align: center;">40</td>
								<td width="30%"><#if rece!=null && scale1!=null>${scale1}％÷${rece}％×100％×40</#if><p class="caption">当月成单数(${zonChendan})/当月接待总数(${zonRece})</p><p class="caption">当月实际接待成交率÷接待成交率任务量×100％×40</p>
								</td>
							</tr>
							
							<tr>
								<th>当月邀请实际到访完成率</th>
								<td><span class="statbar" rel="<#if sum_reserve=='0'>0<#else>root</#if>">${sum_reserve}</span></td>
								<td width="10%" style="text-align: center;">40</td>
								<td width="30%"><#if shidao!=null && res!=null>${shidao}÷${res}×100％×40</#if><p class="caption">当月实际到访个数÷邀约到访任务量×100％×40</p>
								</td>
							</tr>
							</#if>
							
							<#if users?? && users.type==2>
							<#else>
								<#if users?? && users.qq_group==8>
						
								<#else>
							<tr>
								<th>中心评分</th>
								<td><span class="statbar" rel="<#if dfcount=='0'>0<#else>root</#if>">${dfcount}</span></td>
								<td width="10%" style=" text-align: center;">20</td>
								<td width="30%"><#if gradeList??><#list gradeList as grade>${grade.msg}<#if grade_index ==  0>&nbsp+&nbsp</#if></#list></#if>
								</td>
							</tr>
							</#if>
							</#if>
							<#if users?? && users.type==2>
							<tr>
								<th>总计得分</th>
								<td>
								<span class="statbar" rel="<#if zonde=='0'>0/2<#else>root</#if>">
								<#if !sum_rece?? || sum_rece==""><#assign sum_rece=0></#if>
								<#if !sum_reserve?? || sum_reserve==""><#assign sum_reserve=0></#if>
								<#if !dfcount?? || dfcount==""><#assign dfcount=0></#if>
									${sum_rece?number+sum_reserve?number}
								</span>
								</td>
								<td  width="10%" style=" text-align: center;">/</td>
								<td width="30%"><p class="caption">当月接待得分＋实际到访得分＋中心评分</p>
								
								</tr>
							<#else>
								<#if users?? && users.qq_group==8>
								<tr>
									<th>平均分</th>
									<td>
									<span class="statbar" rel="<#if zonde=='0'>0/2<#else>root</#if>">
										${dfcount?number}
									</span>
									</td>
									<td  width="10%" style=" text-align: center;">/</td>
									<td width="30%"><p class="caption">工作完成情况得分＋专业得分＋速度评分＋态度评分</p>
								</tr>
								<#else>
								<tr>
									<th>总计得分</th>
									<td>
									<span class="statbar" rel="<#if zonde=='0'>0/2<#else>root</#if>">
										${sum_rece?number+sum_reserve?number+dfcount?number}
									</span>
									</td>
									<td  width="10%" style=" text-align: center;">/</td>
									<td width="30%"><p class="caption">当月接待得分＋实际到访得分＋中心评分</p>
								</tr>
								</#if>
							</#if>
                            <#if users?? && users.type==2>
                            
							<#else>
								<#if users?? && users.qq_group==8>
									<tr>
	                                <th>绩效工资</th>
									<div id="meritpay">
	                                <td><span class="statbar" id="pay"   rel="<#if zonde=='0'>0/2<#else>root</#if>">
	                                	${(dfcount?number*300)/100}
	                                </span></td>
	                                <td  width="10%" style=" text-align: center;">/</td>
	                                <td width="30%"><p class="caption">绩效工资=绩效工资基准值*当月总得分的百分比</p>
                                </div>
                            </tr>
                            	<#else>
	                            <tr>
	                                <th>绩效工资
									</th>
									<div id="meritpay">
	                                <td><span class="statbar" id="pay"   rel="<#if zonde=='0'>0/2<#else>root</#if>">
	                                	${(sum_rece?number+sum_reserve?number+dfcount?number)*jzz?number/100}
	                                </span></td>
	                                <td  width="10%" style=" text-align: center;">/</td>
	                                <td width="30%"><p class="caption">绩效工资=绩效工资基准值*当月总得分的百分比</p>
	                                </div>
	                            </tr>
                            	</#if>
                            </#if>
						</table>
				</td>
			</tr>
		</table>
					
			<#if users?? && users.qq_group==8>
						
			<#else>		
			<table>
			<tr class="fields">
				<th>个人参考数据</th>
			</tr>
				<tr>
					<td>
						<table id="tbl_reception_<?php echo $i ?>" style="min-width: 100px; width: 80%; float: left; margin: 2px;">
							<tr>
								<th width="30%">个人月度业绩完成率</th>
								<td width="40%"><span class="statbar" rel="<#if sum_money=='0'>0<#else>root</#if>">${sum_money}</span>
								</td>
								<td width="30%"><#if divider!=null && sum!=null>${sum}÷${divider}×100％</#if> <p class="caption">当月实际完成量÷当月任务量×100％</p>
								</td>
							</tr>
							
							<tr>
								<th>每月有效电话量完成情况</th>
								<td><span class="statbar" rel="<#if sum_track=='0'>0<#else>root</#if>">${sum_track}</span></td>
								<td width="30%"><#if cont!=null && tr!=null>${cont}÷${tr}×100%</#if><p class="caption">当月实际电话量÷当月电话任务量×100％</p>
								</td>
							</tr>
							
							
						</table>
				</td>
			</tr>
		</table>
		</#if>
		
				</td>
			</tr>
		</table>
		
		<#if users?? && users.type==2>
		<table>
			<tr class="fields">
				<th>销售主管绩效统计</th>
			</tr>
				<tr>
					<td>
						<table id="tbl_reception_<?php echo $i ?>" style="min-width: 100px; width: 100%; float: left; margin: 2px;">
							<tr class="fields">
								
								<th colspan="2" style="">
									<span class="unit size14 stress"><#if start??>${start?date}</#if>到<#if end??>${end?date}</#if></span></th>
								<td style="text-align: center;">
									<span class="size14 stress">目标量</span>
								</td>
								<td style="text-align: center;">
									<span class="size14 stress">权  重</span>
								</td>
								<td style="text-align: center;">
									<span class="size14 stress">核算方法</span>
								</td>
							</tr>

							<tr>
								<th  width="20%">团队平均个人接待成交率</th>
								<#if !cdlfs?? || cdlfs==""><#assign cdlfs=0></#if>
								<td width="10%"><span class="statbar">${cdlfs}</span></td>
								<td  width="20%" style="text-align: center;">35%</td>
								<td  width="10%" style="text-align: center;">40</td>
								<td width="30%">
								<#if !cdl?? || cdl==""><#assign cdl=0></#if>
								${cdl?string.percent}/35%*40
								<p>成单总数：${c}，到访总数：${d}</p>
								<p class="caption">该项给予额外加权分数，最高得分不超过该项总分的150%</p>
								</td>
							</tr>
							
							<tr>
								<th>当月团队邀约实际到访完成率</th>
								<td><span class="statbar">${daofangfs}</span></td>
								<td  width="10%" style="text-align: center;">8个*团队人员数量</td>
								<td  width="10%" style="text-align: center;">40</td>
								<td width="30%">
								<#if shidaoAll!=null && size??>${shidaoAll}/(8*${size})*100%*40</#if>
								<p class="caption">该项给予额外加权分数，最高得分不超过该项总分的150%</p>
								</td>
							</tr>
							
							<tr>
								<th>中心评分</th>
								<td><span class="statbar">${dfcount}</span></td>
								<td  width="10%" style="text-align: center;">总部领导20分（管理能力、人员稳定、业绩完成情况、续费情况、退费情况等）</td>
								<td  width="10%" style=" text-align: center;">20</td>
								<td width="30%"><#if gradeList??><#list gradeList as grade>${grade.msg}</#list></#if>
								</td>
							</tr>
							
							<tr>
								<th>总分</th>
								<td><span class="statbar">
								<#if !daofangfs?? || daofangfs==""><#assign daofangfs=0></#if>
                                <#if !dfcount?? || dfcount==""><#assign dfcount=0></#if>
								${(cdlfs?number+daofangfs?number+dfcount?number)?string("#.#")}
								</span></td>
								<td  width="10%" style="text-align: center;"></td>
								<td  width="10%" style=" text-align: center;">100</td>
								<td width="30%"></td>
							</tr>
							
							<tr>
                                <th>绩效工资
								</th>
								<div id="meritpay">
                                <td><span class="statbar" id="pay"   rel="<#if zonde=='0'>0/2<#else>root</#if>">
                                <#if !jzz?? || jzz==""><#assign jzz=0></#if>
                                	${((cdlfs?number+daofangfs?number+dfcount?number)?string("#.#"))?number*jzz?number/100}
                                </span></td>
                                <td  width="10%" style=" text-align: center;">/</td>
                                <td></td>
                                <td width="30%">
                                	<p class="caption">绩效工资=${jzz}*${(cdlfs?number+daofangfs?number+dfcount?number)}%</p>
                                	<p class="caption">绩效工资=绩效工资基准值*当月总得分的百分比</p>
                                </td>
                                </div>
                            </tr>
						</table>
				</td>
			</tr>
		</table>
		</#if>
		
		<div class="remark">
			<ul>
				<li><span class="title">注意事项：</span></li>
				<li>1、核算方法中的数据是相对应的，也对应个人业绩月统计分析模块的数据。例如：个人月度业绩：（<#if sum!=null>${sum}</#if>） 对应 （当月实际完成量），（<#if divider!=null>${divider}</#if>） 对应 （当月任务量）</li>
				<li>2、个人月度业绩完成率、当月接待成交率、当月邀请实际到访完成率、每周有效电话量完成情况的每个百分比不超过150%</li>
				<li>3、由于统计需要占用大量的资源，请不要频繁进行统计</li>
				<li>&nbsp;</li>
			</ul>
		</div>
	</div>
</body>
</html>